<?php
namespace app\models;
use yii\helpers\ArrayHelper;


/**
 * 数组转换特性
 * Class DropDownListTrait
 * @package app\models
 * @method \yii\db\ActiveQuery find()
 */
trait DropDownListTrait
{
    public static function getDropDownList($value='name',$key = 'id')
    {
        $models =  self::find()->all();
        return ArrayHelper::map($models,$key,$value);
    }
}